﻿#region Regions

using System;
using System.Collections.Generic;

using FMWare.Core.Base;

#endregion

namespace FMWare.Core.Translations
{
	public class Nation : Item
	{
		#region Constructors

		public Nation()
		{
			AltNationalityNames = new List<String>();
		}

		#endregion

		#region Public Properties

		public List<String> AltNationalityNames { get; set; }
		public Byte AltNationalityNamesCount { get; set; }

		public String Name { get; set; }
		public Byte NameGender { get; set; }
		public String NationalityName { get; set; }
		public String ShortName { get; set; }
		public Byte ShortNameGender { get; set; }
		public String ThreeLetterName { get; set; }

		#endregion

		#region Internal Properties

		internal override string ExportData
		{
			get { return Global.CreateDelimitedString(UniqueId, Name, ShortName, ThreeLetterName, NationalityName); }
		}

		#endregion

		#region Internal Methods

		internal override void Read(BinaryReader reader)
		{
			UniqueId = reader.ReadInt32();
			Name = reader.ReadString();
			NameGender = reader.ReadByte();
			ShortName = reader.ReadString();
			ShortNameGender = reader.ReadByte();
			ThreeLetterName = reader.ReadString();
			NationalityName = reader.ReadString();
			AltNationalityNamesCount = reader.ReadByte();
			for (int i = 0; i < AltNationalityNamesCount; i++)
				AltNationalityNames.Add(reader.ReadString());
		}

		internal override void Write(BinaryWriter writer)
		{
			writer.Write(UniqueId);
			writer.Write(Name);
			writer.Write(NameGender);
			writer.Write(ShortName);
			writer.Write(ShortNameGender);
			writer.Write(ThreeLetterName);
			writer.Write(NationalityName);
			writer.Write(AltNationalityNamesCount);
			for (int i = 0; i < AltNationalityNamesCount; i++)
				writer.Write(AltNationalityNames[i]);
		}

		#endregion
	}
}